package store.lunangangster.nodeflow.parser.el;

import com.ql.util.express.DefaultContext;
import com.ql.util.express.IExpressContext;

/**
 * IExpressContext的持有类
 *
 * @author cwk
 * @version 1.0
 */
public class ELContextHolder {
  private static volatile IExpressContext<String, Object> defaultContext;

  public static IExpressContext<String, Object> getELContext() {
    if (defaultContext == null) {
      synchronized (ELContextHolder.class) {
        if (defaultContext == null) {
          defaultContext = new DefaultContext<>();
        }
      }
    }
    return defaultContext;
  }

  public static void setELContext(IExpressContext<String, Object> elContext) {
    defaultContext = elContext;
  }
}
